package com.work.demo.leetcode.leetcode.editor.cn;

class Solution11 {
    public int maxArea(int[] a) {

        int l = 0, r = a.length - 1;
        int max = 0;
        while (l < r) {
            int minHeight = a[l] < a[r] ? a[l++] : a[r--];
            int area = (r - l + 1) * minHeight;
            max = Math.max(max, area);
        }
        return max;

    }
}